package com.travel.admin.config;


import com.obs.services.ObsClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

/**
 * Created by hongming
 */
@Configuration
public class ObsConfig {
    @Value("${file.obs.endPoInt}")
    private  String endPoInt;
    @Value("${file.obs.accessKeyId}")
    private  String key;
    @Value("${file.obs.accessKeySecret}")
    private  String secret;



    @Bean
   public ObsClient getObsClient(){
        ObsClient ossClient = new ObsClient(key,secret,endPoInt);
       return ossClient;
   }
    @Bean
    public CommonsMultipartResolver getCommonsMultipartResolver() {
        CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
        multipartResolver.setMaxUploadSize(209715200);
        multipartResolver.setMaxInMemorySize(1048576);
        return multipartResolver;
    }
}
